<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
        <meta name="author" content="order by dede58.com"/>
		<title>小米手机列表</title>
		<link rel="stylesheet" type="text/css" href="./css/style.css">
	</head>
	<body>
	<!-- start header -->
		<header>
			<div class="top center">
				<div class="left fl">
					<ul>
						<li><a href="http://www.mi.com/" target="_blank">小米商城</a></li>
						<li>|</li>
						<li><a href="">MIUI</a></li>
						<li>|</li>
						<li><a href="">米聊</a></li>
						<li>|</li>
						<li><a href="">游戏</a></li>
						<li>|</li>
						<li><a href="">多看阅读</a></li>
						<li>|</li>
						<li><a href="">云服务</a></li>
						<li>|</li>
						<li><a href="">金融</a></li>
						<li>|</li>
						<li><a href="">小米商城移动版</a></li>
						<li>|</li>
						<li><a href="">问题反馈</a></li>
						<li>|</li>
						<li><a href="">Select Region</a></li>
						<div class="clear"></div>
					</ul>
				</div>
				<div class="right fr">
					<div class="gouwuche fr">
						<c:if test="${not empty user}">
							<a href="javascript:void(0);" onclick="toGW()">购物车 <b>${cartNum}</b></a>
						</c:if>
						<c:if test="${empty user}">
							<span onclick="javascript:alert('请先登录')">购物车</span>
						</c:if>
					</div>
					<div class="fr">
				<c:if test="${empty user}">
					<div class="login_btn left fl">
					<a href="login.jsp" style="color:#B0B0B0;">登录</a>
					<span>|</span>
					<a href="register.jsp" style="color:#B0B0B0;">注册</a>
					<span>|</span>
					</div>
				</c:if>	
				<c:if test="${not empty user}">
					<span style="color:#B0B0B0; margin-right:10px;">欢迎您：${user.uname}</span>
					<a href="user_center_info.jsp" style="color:#B0B0B0;">个人中心</a>
				</c:if>
					</div>
					<div class="clear"></div>
				</div>
				<div class="clear"></div>
			</div>
		</header>
	<!--end header -->

<!-- start banner_x -->
		<div class="banner_x center">
			<a href="./index.jsp" target="_blank"><div class="logo fl"></div></a>
			<a href=""><div class="ad_top fl"></div></a>
			<div class="nav fl">
				<ul>
					<li><a href="javascript:void(0);" onclick="liebiao(1)">小米手机</a></li>
					<li><a href="javascript:void(0);" onclick="liebiao(2)">红米</a></li>
					<li><a href="javascript:void(0);" onclick="liebiao(3)">笔记本</a></li>
					<li><a href="javascript:void(0);" onclick="liebiao(7)">平板</a></li>
					<li><a href="javascript:void(0);" onclick="liebiao(4)">电视</a></li>
					<li><a href="javascript:void(0);" onclick="liebiao(5)">路由器</a></li>
					<li><a href="javascript:void(0);" onclick="liebiao(6)">智能硬件</a></li>
					<li><a href="">服务</a></li>
					<li><a href="">社区</a></li>
				</ul>
			</div>
			
		</div>
<!-- end banner_x -->

	<!-- start banner_y -->
	<!-- end banner -->

	<!-- start danpin -->
		<div class="danpin center">
			
			<div class="biaoti center">${tyname}</div>
				<div class="main center mb20" id="showGoods">
				<c:forEach var="good" items="${list}" varStatus="i">
					<div class="mingxing fl mb20" style="border:2px solid #fff;width:230px;cursor:pointer;" onmouseout="this.style.border='2px solid #fff'" onmousemove="this.style.border='2px solid red'">
						<div class="sub_mingxing"><a href="javascript:void(0);" onclick="toXQ(${good.gid})"><img src="./${good.pic}" alt=""></a></div>
						<div class="pinpai"><a href="javascript:void(0);" onclick="toXQ(${good.gid})">${good.tname}</a></div>
						<div class="youhui">骁龙820处理器 / UFS 2.0 闪存</div>
						<div class="jiage">${good.price}</div>
					</div>
				</c:forEach>
				</div>
		</div>
		
		<footer class="mt20 center" style="clear: both;">
			<div class="mt20">小米商城|MIUI|米聊|多看书城|小米路由器|视频电话|小米天猫店|小米淘宝直营店|小米网盟|小米移动|隐私政策|Select Region</div>
			<div>©mi.com 京ICP证110507号 京ICP备10046444号 京公网安备11010802020134号 京网文[2014]0059-0009号</div> 
			<div>违法和不良信息举报电话：185-0130-1238，本网站所列数据，除特殊说明，所有数据均出自我司实验室测试</div>

		</footer>
<script type="text/javascript" src="js/jquery-1.12.4.min.js"></script>
	<script>
		//根据tid跳转列表页面进行查询这个类别的所有商品
		function liebiao(tid){
			var tid=parseInt(tid);
			$.post("goodServlet",{
				op:"findTypeByTid",
				tid:tid
			},function(data){
				if(data>0){
					location.href="liebiao.jsp";
				}
			},"text");
		}
		//查询某个商品的详情   发ajax请求发送成功  则跳转详情页面  并进行显示
		function toXQ(gid){
			var gid=parseInt(gid);
			$.post("goodServlet",{
				op:"findGoodsByGid",
				gid:gid
			},function(data){
				if(data>0){
					location.href="xiangqing.jsp";
				}
			},"text");
		}
		
		//跳转至购物车界面  显示购物车信息
		function toGW(){
			$.post("cartinfoServlet",{
				op:"findCart"
			},function(data){
				if(data>0){
					//如果成功跳转购物车界面然后显示信息
					location.href="gouwuche.jsp";
				}else{
					alert("网络异常。。。。");
				}
			},"text");
		}
	</script>
	

	</body>
</html>